<?include dirname(__FILE__).'/../../include/js/table.php' ?>
<h4><?php echo lang('Table Structure for ')?> <i><?php echo $tableName?></i></h4>
<p>
	<a href="<?php echo common::url('query.php?sql=' . rawurlencode('SELECT * FROM ' . $tableName))?>"><?=lang('Browse')?></a> ::
	<a href="<?php echo common::url('query.php?table=' . rawurlencode($tableName))?>"><?=lang('Query')?></a> ::
	<a href="<?php echo common::url('row.php?action=insert&table=' . rawurlencode($tableName) . "&redirect=" . rawurlencode("table.php?table=$tableName"))?>"><?=lang('Insert')?></a> ::
	<a href="<?php echo common::url("table.php?action=empty&table=" . rawurlencode($tableName) . "&redirect=" . rawurlencode("table.php?table=$tableName"))?>" onclick="return confirm('<?=javascript::escapeString(lang('Are you sure you want to delete all rows from this table?'))?>')"><?=lang('Empty')?></a> ::
	<a href="<?php echo common::url('table.php?action=drop&table=' . rawurlencode($tableName))?>" onclick="return confirm('<?=javascript::escapeString(lang('Are you sure you want to drop this table?'))?>')"><?=lang('Drop')?></a>
</p>
<table border="0">
<tr>
	<th><?php echo lang('Column Name')?></th>
	<th><?php echo lang('Type')?></th>
	<th><?php echo lang('NULL')?></th>
	<th><?php echo lang('Default Value')?></th>
	<th><?php echo lang('Actions')?></th>
</tr>
<?php
foreach($structure as $s)
{?>
<tr>
	<td><?php echo $s['name']?></td>
	<td><?php echo $s['type']?></td>
	<td><?php echo $s['notnull'] == 0 ? lang('Yes') : lang('No')?></td>
	<td><?php echo $s['dflt_value']?></td>
	<td><a href="javascript: void(addIndex('<?php echo rawurlencode($s['name'])?>', false))">Index</a> :: <a href="javascript: void(addIndex('<?php echo rawurlencode($s['name'])?>', true))">Unique</a></td>
</tr>
<?php
}
?>
<tr>
	<td class="summary"><?printf(lang('%s column(s)'), $rowCount)?></td>
</tr>
</table>
<h4><?=lang('Indexes')?></h4>
<table border="0">
<tr>
	<th><?php echo lang('Index Name')?></th>
	<th><?php echo lang('Column')?></th>
	<th><?php echo lang('Unique')?></th>
	<th><?php echo lang('Actions')?></th>
</tr>
<?php
foreach($indexes as $i)
{
?>
<tr>
	<td><?php echo $i['name']?></td>
	<td><?php echo $i['column']?></td>
	<td align="center"><?php echo $i['unique'] ? lang('Yes') : lang('No')?></td>
	<td><a href="<?php echo common::url("table.php?table=$tableName&action=dropindex&index=" . rawurlencode($i['name']))?>" onclick="return confirm('<?php echo lang('Are you sure you want to drop this index?')?>')"><?php echo lang('Drop')?></a></td>
</tr>
<?php
}
?>
</table>